package assist.datastore.parser;

import java.io.File;
import java.io.IOException;

import assist.domain.model.Team;

public class NHLTeamCSVParser extends NHLCSVParser<Team> 
{
    
    private static final long serialVersionUID = 1L;

    public NHLTeamCSVParser(final File csvFile) throws IOException
    {
       super(csvFile, 0);
    }

    @Override
    protected Team parseObject(String[] tokens)
    {        
        if (!tokens[9].equals("NHL") || !tokens[7].isEmpty())
        {
            return null;
        }
        Team team = new Team();
        team.setAbbreviation(tokens[0]);
        team.setTeamId(new Long(tokens[8]));
        team.setCity(tokens[1]);
        team.setNickname(tokens[2]);
        return team;
    }
}
